<!DOCTYPE html>
<!-- saved from url=(0041)http://c.tsz90.com/home/task/addto?id=587 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php echo $type ?></title>
<link rel="stylesheet" href="__PUBLIC__/static/css/renwu/taskdatail.css">
<!-- 弹出层 -->
<script src="__PUBLIC__/static/js/renwu/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/js/renwu/public.js"></script>
</head>
<body style="background: rgb(255, 255, 255);">
<header class="bg_header">
	<a onclick="history.back()" class="left"><img src="__PUBLIC__/static/upload/renwu/icon_back.png" alt=""></a>
	<?php echo $type ?>	
</header>

<div class="setpage">
	<div class="container">
		<h3>设置步骤</h3>
		<h3 class="release_title">填写基本信息<img src="__PUBLIC__/static/upload/renwu/icon_add02.png" alt="" id="button_set"></h3>
				<input type="hidden" value="587" id="id">
		<div class="infor_card">
			<div class="inline_form" id="net_box">
				<label for="">输入网址</label>
				<div class="right"><img src="__PUBLIC__/static/upload/renwu/icon_red.png" alt="" class="red_icon"></div>
			</div>
			<div class="inline_form" id="ewm_box">
				<label for="">传二维码</label>
				<div class="right"><img src="__PUBLIC__/static/upload/renwu/icon_red.png" alt="" class="red_icon"></div>
			</div>
			<div class="inline_form" id="textpic_box">
				<label for="">图文说明</label>
				<div class="right"><img src="__PUBLIC__/static/upload/renwu/icon_red.png" alt="" class="red_icon"></div>
			</div>
			<div class="inline_form" id="copy_box">
				<label for="">复制数据</label>
				<div class="right"><img src="__PUBLIC__/static/upload/renwu/icon_red.png" alt="" class="red_icon"></div>
			</div>
			<div class="inline_form" id="collectpic_box">
				<label for="">收集截图</label>
				<div class="right"><img src="__PUBLIC__/static/upload/renwu/icon_red.png" alt="" class="red_icon"></div>
			</div>
			<div class="inline_form" id="collectinfor_box">
				<label for="">收集信息</label>
				<div class="right"><img src="__PUBLIC__/static/upload/renwu/icon_red.png" alt="" class="red_icon"></div>
			</div>
		</div>
	</div>

<!-- 不存在数据  那么直接显示 -->
<div id="net_box_content">
	<div class="myshandow"></div>
	<div class="tanchu_box">
		<h3>输入网址</h3>
		<form action="release?id=<?php echo $res['id'] ?>">
			<input type="hidden" value="" id="net_box_content_url_id">
			<h4>步骤说明：</h4>
			<textarea name="" id="urldec" placeholder="适用于需要点击链接，访问网页的操作。输入内容，提示打开网址相关操作注意事项！"></textarea>
			<div class="inline_form" style="background: none">
				<label for="">填写网址:</label>
				<div class="right">
					<input type="text" placeholder="链接" id="url">
				</div>
			</div>
			<div class="invite_btn">
					<a href="javascript:;" class="btn2">取消</a>
					<a href="javascript:;" onclick="addto(this,&#39;输入网址&#39;,&#39;net_box_content&#39;,0)">添加</a>
			</div>
		</form>
	</div>
</div>
<!-- 传二维码 -->
<div id="ewm_box_content">
	<div class="myshandow"></div>
	<div class="tanchu_box">
		<h3>传二维码</h3>
		<form action="release?id=<?php echo $res['id'] ?>">
			<input type="hidden" value="" id="ewm_box_content_url_id">
			<h4>步骤说明</h4>
			<textarea name="" rows="5" placeholder="适用于需要扫描二维码的操作。输入内容，详细说明需要用什么设备，如何扫描等。并且上传二维码！"></textarea>
			<div class="inline_form">
				<label for="">二维码图</label>
				<div class="right a-upload">
					<input id="ewm_box_content_file" onclick="imgchange(&#39;ewm_box_content&#39;)" type="file" name="file" style="">点击这里上传文件
				</div>
			</div>
			<div class="invite_btn">
					<a href="javascript:;" class="btn2">取消</a>
					<a href="javascript:;" onclick="addto(this,&#39;传二维码&#39;,&#39;ewm_box_content&#39;,1)">添加</a>
			</div>
			<div style="text-align: center;"><img id="img_ewm_box_content" src="__PUBLIC__/static/upload/renwu/img.png" width="100px" height="100px"></div>
		</form>
	</div>
</div>
<!-- 图文说明 -->
<div id="textpic_box_content">
	<div class="myshandow"></div>
	<div class="tanchu_box">
		<h3>图文说明</h3>
		<form action="release?id=<?php echo $res['id'] ?>">
			<input type="hidden" value="" id="textpic_box_content_url_id">
			<h4>步骤说明</h4>
			<textarea name="" rows="5" placeholder="适用于需要图片说明，引导悬赏人的操作。输入内容，详细说明需要注意的哪些事项等！"></textarea>
			<div class="inline_form">
				<label for="">图片说明</label>
				<div class="right a-upload">
					<input id="textpic_box_content_file" onclick="imgchange(&#39;textpic_box_content&#39;)" type="file" name="file" style="">点击这里上传文件
				</div>
			</div>
			<div class="invite_btn">
					<a href="javascript:;" class="btn2">取消</a>
					<a href="javascript:;" onclick="addto(this,&#39;图文说明&#39;,&#39;textpic_box_content&#39;,1)">添加</a>
			</div>
			<div style="text-align: center;"><img id="img_textpic_box_content" width="100px" height="100px"></div>
		</form>
	</div>
</div>
<!-- 复制数据弹出 -->
<div id="copy_box_content">
	<div class="myshandow"></div>
	<div class="tanchu_box">
		<h3>复制数据</h3>
		<form action="release?id=<?php echo $res['id'] ?>">
			<input type="hidden" value="" id="copy_box_content_url_id">
			<h4>步骤说明：</h4>
			<textarea name="" id="urldec" placeholder="适用于需要复制数据，如填写邀请码。输入内容，提示会员复制数据，方便填写！"></textarea>
			<div class="inline_form" style="background: none">
				<label for="">填写数据:</label>
				<div class="right">
					<input type="text" placeholder="如邀请码，钱包地址之类" id="copyc">
				</div>
			</div>
			<div class="invite_btn">
					<a href="javascript:;" class="btn2">取消</a>
					<a href="javascript:;" onclick="addto(this,&#39;复制数据&#39;,&#39;copy_box_content&#39;,0)">添加</a>
			</div>
		</form>
	</div>
</div>
<!-- 收集截图弹出 -->
<div id="collectpic_box_content">
	<div class="myshandow"></div>
	<div class="tanchu_box">
		<h3>收集截图</h3>
		<form action="release?id=<?php echo $res['id'] ?>">
			<input type="hidden" value="" id="collectpic_box_content_url_id">
			<h4>步骤说明</h4>
			<textarea name="" rows="5" placeholder="适用于收集截图结果。输入内容，详细说明需要截取哪个界面，符合什么要求等。并且上传图片演示！"></textarea>
			<div class="inline_form">
				<label for="">选择截图</label>
				<div class="right a-upload">
					<input id="collectpic_box_content_file" onclick="imgchange(&#39;collectpic_box_content&#39;)" type="file" name="file" style="">点击这里上传文件
				</div>
			</div>
			<div class="invite_btn">
					<a href="javascript:;" class="btn2">取消</a>
					<a href="javascript:;" onclick="addto(this,&#39;收集截图&#39;,&#39;collectpic_box_content&#39;,1)">添加</a>
			</div>
			<div style="text-align: center;"><img id="img_collectpic_box_content" width="100px" height="100px"></div>
		</form>
	</div>
</div>
<!-- 收集信息弹出 -->
<div id="collectinfor_box_content">
	<div class="myshandow"></div>
	<div class="tanchu_box">
		<h3>收集信息</h3>
		<form action="release?id=<?php echo $res['id'] ?>">
			<input type="hidden" value="" id="collectinfor_box_content_url_id">
			<h4>收集信息：</h4>
			<textarea id="urldec" name="" rows="5" placeholder="适用于收集手机号，用户名，姓名，ID等。输入内容，详细说明你需要收集什么！"></textarea>
			<div class="invite_btn">
					<a href="javascript:;" class="btn2">取消</a>
					<a href="javascript:;" onclick="addto(this,&#39;收集信息&#39;,&#39;collectinfor_box_content&#39;,0)">添加</a>
			</div>
		</form>
	</div>
</div>

<div class="fix_bottom_btns">
	<a href="preview?pro_name=<?php echo $pro_name ?>" class="a1">预览</a>
	<a href="javascript:void(0)" onclick="aClick(<?php echo $res['id'] ?>)" class="a2">申请发布</a>
</div>

<script>
	$(function(){	
	  //导航展开
	$("#button_set").click(function(){
		    if($(".infor_card").hasClass("open")){	    	
		       $(".infor_card").removeClass("open");
		    }else{
		       $(".infor_card").addClass("open");
		    }
	  })
	// 收集截图弹出	
	$("#collectpic_box").click(function(){
		   $("#collectpic_box_content").find('#collectpic_box_content_url_id').val('');
		   $("#collectpic_box_content").find('textarea').val('');
		   $("#collectpic_box_content").find('#img_collectpic_box_content').attr('src','__PUBLIC__/static/upload/renwu/img.png');
		   $("#collectpic_box_content").show();
	  })
	$("#collectpic_box_content .btn2").click(function(){
		   $("#collectpic_box_content").hide();
	  })

	// 收集信息弹出	
	$("#collectinfor_box").click(function(){
		   $("#collectinfor_box_content").find('#collectinfor_box_content_url_id').val('');
		   $("#collectinfor_box_content").find('textarea').val('');
		   $("#collectinfor_box_content").show();
	  })
	$("#collectinfor_box_content .btn2").click(function(){
		   $("#collectinfor_box_content").hide();
	  })
	  
	//传二维码弹出	
	$("#ewm_box").click(function(){
		   $("#ewm_box_content").find('#ewm_box_content_url_id').val('');
		   $("#ewm_box_content").find('textarea').val('');
		   $("#ewm_box_content").find('#img_ewm_box_content').attr('src','__PUBLIC__/static/upload/renwu/img.png');
		   $("#ewm_box_content").show();
	  })
	$("#ewm_box_content .btn2").click(function(){
		   $("#ewm_box_content").hide();
	  }) 
	  
	//复制数据弹出	
	$("#copy_box").click(function(){
		   $("#copy_box_content").find('#copy_box_content_url_id').val('');
		   $("#copy_box_content").find('textarea').val('');
		   $("#copy_box_content").find('#copyc').val('');
		   $("#copy_box_content").show();
	  })
	$("#copy_box_content .btn2").click(function(){
		   $("#copy_box_content").hide();
	  }) 
	//图文说明弹出	
	$("#textpic_box").click(function(){
		   $("#textpic_box_content").find('#textpic_box_content_url_id').val('');
		   $("#textpic_box_content").find('textarea').val('');
		   $("#textpic_box_content").find('#img_textpic_box_content').attr('src','__PUBLIC__/static/upload/renwu/img.png');
		   $("#textpic_box_content").show();
	  })
	$("#textpic_box_content .btn2").click(function(){
		   $("#textpic_box_content").hide();
	  })
	  
	// 输入网址弹出
	$("#net_box").click(function(){
		   alert($("#net_box_content").find('#net_box_content_url_id').val(''));
		   $("#net_box_content").find('textarea').val('');
		   $("#net_box_content").find('#url').val('');
		   $("#net_box_content").show();
	  })
    // 输入网址关闭
    $("#net_box_content .btn2").click(function(){
		   $("#net_box_content").hide();
	  })
	})
	
	function addto(_this,tos_name,identification,img){
		//添加一行网址
		var urldec = $(_this).parent().parent().find('textarea').val();
		// alert(urldec);
		var url = $(_this).parent().parent().find('#url').val();
		var url_id = $(_this).parent().parent().find('#'+identification+'_url_id').val();
		// alert(url_id);
		var copyc = $(_this).parent().parent().find('#copyc').val();
		alert(copyc);
		//var file = document.getElementById(identification+"_file").files[0];

		var id = $("#id").val();
        var formData = new FormData();
        formData.append('content', urldec);
        formData.append('copyc', copyc);
        formData.append('url', url);
        formData.append('id', id);
        formData.append('tos_name', tos_name);
        formData.append('identification', identification);
        formData.append('url_id', url_id);
        if(img==1){
			var file = $(_this).parent().prev().children(".right").children('#'+identification+'_file').get(0).files[0];
	        formData.append('file', file);
		}
		// alert(formData);
		//return false;
		$.ajax({
            //请求方式
            type : "POST",
            //请求地址
            url : "addto",
            //数据，json字符串
            data : formData,
            contentType: false,
            processData: false,
            mimeType: "multipart/form-data",
            //请求成功
            success : function(result) {
                // console.log(result);
                // if(result!=0){
                // 	window.location.reload()
                	/* $("#"+identification).hide();

                	//$("."+identification).parent().remove();
                    var str = '<h3 class="release_title"><span class="tclick '
                        +identification
                        +'" data-id="'
                        +identification
                        +'" style="color:blue" >'
                        +tos_name
                        +'</span>'
                        +'<img src="/static/home/mobile/images/icon_red.png" alt="" class="button_del"></h3>';
                    $("#id").after(str);

                    $("#urldec").val(urldec);
            		$("#url").val(url);
            		$("#url_id").val(result);
            		$(".infor_card").removeClass("open"); */
                // }
            }
        });
	}
	
	
	//编辑一行
	$(document).on('click', '.tclick', function() {
		   var showid = $(this).attr('data-id');
		   console.log(showid);
		   $("#"+showid).show();
		   
		   var key = $(this).attr('data-key');
		   $('#'+showid+'_url_id').val(key);


		   var value = $(this).attr('data-value');
		   value = JSON.parse(value);
		   console.log(value);
		   //输入网址
    	   if(showid=='net_box_content'){
    		   $("#"+showid).find('textarea').val(value.content);
    		   $("#"+showid).find('#url').val(value.url);
   	        }
		   //二维码
    	   if(showid=='ewm_box_content'){
    		   $("#"+showid).find('textarea').val(value.content);
    		   $("#"+showid).find('#img_ewm_box_content').attr('src','/uploads/'+value.image);
   	        }
		   //图文说明
    	   if(showid=='textpic_box_content'){
    		   $("#"+showid).find('textarea').val(value.content);
    		   $("#"+showid).find('#img_textpic_box_content').attr('src','/uploads/'+value.image);
   	        }
		   //复制数据
    	   if(showid=='copy_box_content'){
    		   $("#"+showid).find('textarea').val(value.content);
    		   $("#"+showid).find('#copyc').val(value.copyc);
   	        }
		   //收集截图
    	   if(showid=='collectpic_box_content'){
    		   $("#"+showid).find('textarea').val(value.content);
    		   $("#"+showid).find('#img_collectpic_box_content').attr('src','/uploads/'+value.image);
   	        }
		   //收集信息
    	   if(showid=='collectinfor_box_content'){
    		   $("#"+showid).find('textarea').val(value.content);
   	        }
		   
	  })
	  
	  
	  //删除一行
	  $(document).on('click', '.button_del', function() {
		   var delid = $(this).prev().attr('data-id');
		   var delkey = $(this).prev().attr('data-key');
		   console.log(delid);
		   var _this = $(this);
		   $.ajax({
	            //请求方式
	            type : "POST",
	            //请求地址
	            url : "/home/task/del",
	            //数据，json字符串
	            data : {id:delkey},
	            //请求成功
	            success : function(result) {
	                console.log(result);
	                _this.parent().remove();
	            },
	            //请求失败，包含具体的错误信息
	            error : function(e){
	                console.log(e);
	            }
	        });
		   
	  })
	function imgchange(filefile){
		  //html5实现图片预览功能
	    $("#"+filefile).change(function (e) {
	        var file = e.target.files[0] || e.dataTransfer.files[0];
	        if (file) {
	            var reader = new FileReader();
	            reader.onload = function () {
	                $("#img_"+filefile).attr("src", this.result);
	            }

	            reader.readAsDataURL(file);
	        }
	    });
	}
	
    

	function aClick(obj){
　　		$.ajax({
                type:"post",
                url:"addtook",
                data:{id:obj},
                success:function(ret){
					var json=JSON.parse(ret);
            	if(json.code==0){
					myalert(json.msg);
					var id=json.id;
					// alert(id);
					location.href="http://www.tp.com/thinkphp5/public/index.php/index/renwu/addss?id="+id;
            	}else{
            		myalert(json.msg);
            	}
                }
            })
	}
	
</script>
		
 </div></body></html>